<?php
	
	/**
	 * undocumented class
	 *
	 * @package default
	 * @author Brian Bal
	 **/
	class ControllerGenerator Extends BaseGenerator
	{
		
		public function generate($params)
		{
			print_r($params);
			
			if(isset($params[2]))
			{
				$this->controller_name = $params[2];
			}else{
				printUsage();
				exit();
			}
			
			// generate the Controller file
			$this->table_name = strtolower($this->controller_name);
			$this->controller_name = ucfirst($this->controller_name) . "_Controller";
			$this->human_name = humanize($this->table_name);
			$filename = PROJECT_DIR . "app/controllers/$this->table_name.php";
			$content = $this->renderFile(PROJECT_DIR . "scripts/generators/Controller/templates/controller.php");
			$this->writeFile($filename, $content);
			
			// generate the view directory for this controller
			$this->createFolder(PROJECT_DIR . "app/views/$this->table_name");
			
			// generate the index view
			$filename = PROJECT_DIR . "app/views/$this->table_name/index.html";
			$content = $this->renderFile(PROJECT_DIR . "scripts/generators/Controller/templates/index_view.php");
			$this->writeFile($filename, $content);
		}
		
	} // END class
